<!-- 公告列表 -->
<!-- 公告列表 -->
<!-- 公告列表 -->

<template>
  <div>
    <myDivider name="公告发布"></myDivider>

    <!-- 顶部搜索 -->
    <div style="margin-left: 20px;">
      <el-date-picker @change="SSClick" value-format="yyyy-MM-dd" style="width: 250px;" v-model="typeTime"
        type="daterange" unlink-panels :range-separator="null" start-placeholder="开始日期" end-placeholder="结束日期">
      </el-date-picker>
      <el-input class="width1" v-model="keytitle" placeholder="输入标题查询"></el-input>
      <el-button type="primary" @click="SSClick">搜索</el-button>
      <div style="margin-top: 10px;">
        <el-button type="primary" @click="AddClick">新增</el-button>
        <el-button @click="sealClick">印章管理</el-button>
      </div>
    </div>

    <!-- 表格列表 -->
    <div class="tableBox">
      <el-table :data="tableData" style="width: 100%">
        <el-table-column align="center" prop="title" label="标题" width="200">
        </el-table-column>
        <el-table-column align="center" prop="unitName" label="发文单位">
        </el-table-column>
        <el-table-column align="center" prop="pushDescription" label="内容概要" width="200">

          <template slot-scope="scope">
            <el-tooltip class="item" effect="dark" :content="getChinese(scope.row.pushDescription)"
              placement="top-start">
              <span> {{
                getChinese(scope.row.pushDescription).length > 8 ? '...' +
                  getChinese(scope.row.pushDescription).slice(getChinese(scope.row.pushDescription).length - 8) :
                  getChinese(scope.row.pushDescription)
              }}</span>
            </el-tooltip>
          </template>
        </el-table-column>
        <el-table-column align="center" prop="pushTimeStr" label="推送时间" width="180">

          <template slot-scope="scope">
            <span>{{ scope.row.pushTimeStr ? scope.row.pushTimeStr : '-' }}</span>
          </template>
        </el-table-column>
        <el-table-column align="center" prop="status" label="状态" width="200">

          <template slot-scope="scope">
            <span>{{ statusList[scope.row.status] }}</span>
          </template>
        </el-table-column>
        <el-table-column align="center" label="操作" width="160">

          <template slot-scope="scope">
            <!-- <div style="display: flex;margin-top: 10px;justify-content: space-between;">
              <el-button size="small" icon="el-icon-document" @click="BtnClick('XQform', scope.row)"
                type="primary">详情</el-button>
              <el-button :disabled="scope.row.status == 2" size="small" icon="el-icon-position"
                @click="BtnClick('FaBuform', scope.row)" type="warning">发布</el-button>
              <el-button size="small" icon="el-icon-delete" type="danger"
                @click="BtnClick('delete', scope.row)">删除</el-button>
            </div> -->
            <div class="textBtn">
              <el-row>
                <el-col class="el" :span="8">
                  <span style="color: #5fadff;cursor: pointer;font-weight: 600;"
                    @click="BtnClick('XQform', scope.row)">详情</span>
                </el-col>
                <el-col class="el" :span="8">
                  <span style="cursor: pointer;font-weight: 600;"
                    :style="{ color: !scope.row.checkRelease ? 'rgba(95, 173, 255,0.5)' : '#5fadff' }"
                    @click="BtnClick('FaBuform', scope.row)">发布</span>
                </el-col>
                <el-col class="el" :span="8">
                  <span style="color: #5fadff;cursor: pointer;font-weight: 600;"
                    @click="BtnClick('delete', scope.row)">删除</span>
                </el-col>
              </el-row>
            </div>
          </template>
        </el-table-column>
        <!-- <el-table-column prop="roomName" label="房间信息" width="200">
          <template slot-scope="scope">
            <el-tooltip class="item" effect="dark" :content="scope.row.roomName" placement="top-start">
              <span> {{
                scope.row.roomName.length > 8 ? '...' + scope.row.roomName.slice(scope.row.roomName.length - 8) :
                scope.row.roomName
              }}</span>
            </el-tooltip>
          </template> 
        </el-table-column> -->
      </el-table>
    </div>

    <!-- 分页器 -->
    <myPagination :pageSize="pageSize" :total="total" @PageChange="PageChange" @pageSizeChange="pageSizeChange">
    </myPagination>
    <!-- 所有弹窗 -->



    <!--发布公告 -->
    <div class="FBGGStyle">
      <el-dialog :close-on-press-escape="false" :close-on-click-modal="false" @close="popCloseChange('FaBuform')"
        :title="AddOrUpdate == 'update' ? '公告详情' : '发布公告'" :visible.sync="FaBuShow" width="850px">
        <el-form ref="FaBuform" :rules="FaBuRules" :model="FaBuData" label-width="110px">
          <div style="display: flex;">
            <el-form-item label="标题" prop="title">
              <el-input style="width: 300px;" v-model="FaBuData.title" placeholder="请输入标题"></el-input>
            </el-form-item>
            <el-form-item label="电子印章">
              <el-radio v-model="isSeal" label="盖章" @change="radioChange">盖章</el-radio>
              <el-radio v-model="isSeal" label="不盖章" @change="radioChange">不盖章</el-radio>
            </el-form-item>
          </div>
          <div style="display: flex;">
            <el-form-item label="主题词">
              <el-input style="width: 300px;" v-model="FaBuData.theme" placeholder="请输入主题词"></el-input>
            </el-form-item>
            <el-form-item class="ZNHStyle" label="字" style="margin-left: -44px;">
              <el-input style="width: 72px;" v-model="FaBuData.characters" placeholder="请输入" maxlength="10"></el-input>
              <span>年</span>
              <el-input style="width: 90px;" type="number" v-model="FaBuData.years" placeholder="输入数字"></el-input>
              <span>号</span>
              <el-input style="width: 90px;" type="number" v-model="FaBuData.number" placeholder="输入数字"></el-input>
            </el-form-item>
          </div>
          <div style="display: flex;">
            <el-form-item label="推送方式" prop="pushCategory">
              <el-select style="width: 300px;" v-model="FaBuData.pushCategory" placeholder="请选择推送方式">
                <el-option label="立即推送" :value="1"></el-option>
                <el-option label="定时推送" :value="2"></el-option>
              </el-select>
            </el-form-item>
            <el-form-item style="margin-left: 30px;" v-if="FaBuData.pushCategory == 2" label="定时推送时间"
              prop="regularTimeStr">
              <el-date-picker value-format="yyyy-MM-dd HH:mm:ss" style="width: 225px;" v-model="FaBuData.regularTimeStr"
                type="datetime" placeholder="选择日期时间">
              </el-date-picker>
            </el-form-item>
          </div>
          <div style="display: flex;">
            <el-form-item label="推送对象" prop="count" style="display: flex;flex-direction: column;">
              <div style="margin-left: -110px;">
                <el-select style="width: 160px;" v-model="pushObjType" placeholder="请选择推送范围" @change="pushObjTypeChange"
                  @visible-change="visibleChange">
                  <el-option label="小区" value="appUser"></el-option>
                  <el-option label="社区" value="community"></el-option>
                  <el-option v-if="logOnUser.unitType != 'company'" label="机关" value="agency"></el-option>
                  <el-option v-if="logOnUser.unitType != 'agency'" label="机构" value="company"></el-option>

                </el-select>
                <el-input placeholder="请选择推送人员" disabled style="width: 250px;"
                  :value="`已选择数量：${FaBuData.count}`"></el-input>

              </div>
            </el-form-item>
            <el-form-item class="ZhuTiTuStyle" label="主题图" prop="" required>
              <!-- 展示 -->
              <div v-if="FaBuData.image" style="position: relative;">
                <el-image style="width: 180px; height: 77px" :src="FaBuData.image"
                  :preview-src-list="TZGGShowList"></el-image>
                <i @click="deleteImg" class="el-icon-circle-close"
                  style="position: absolute;right: 5px;top: 5px; color: white;"></i>
              </div>
              <!-- 上传 -->
              <myuploadFBGG v-else @getImgList="getImgList" ref="myupload3" :FileList="FileList"
                uploadUrl="/business/notice/uploadImg" deleteUrl="/business/notice/deleteImg">
              </myuploadFBGG>
            </el-form-item>
          </div>
          <el-form-item label="推送内容" style="display: flex;flex-direction: column;">
            <div style="margin-left: -110px;">
              <Richtext @DeleteFile="DeleteFile" :files="files" uploadImgUrl="/business/contract/uploadImg"
                uploadFileUrl="/business/notice/uploadAnnex" v-if="RichtextShow" ref="Richtext" @getFile="getFile"
                :content.sync="content"></Richtext>
            </div>
          </el-form-item>
          <el-form-item v-if="AddOrUpdate == 'update' && FaBuData.scheduleList && DetailRes.unitType != 'system'"
            label="审核进度">
            <div style="margin-top: 20px;line-height: 0px;">
              <el-steps :space="60" v-if="FaBuData.scheduleList.length > 0" direction="vertical" :active="scheduleDrop">
                <el-step
                  :title="item.name == 'begin' ? '发起审批' : `${item.depName ? item.depName : '--'}部门 ${item.name ? item.name : '--'}审批`"
                  v-for="item, i in FaBuData.scheduleList"
                  :description="item.name == 'begin' ? '' : `审批结果：${item.result}`" :key="i">
                </el-step>
              </el-steps>
              <div style="color: #aaa;" v-else>暂无审核进度</div>
            </div>
          </el-form-item>
        </el-form>
        <div slot="footer" class="dialog-footer">
          <el-button size="mini" @click="Preview('PC')">电脑端预览</el-button>
          <el-button size="mini" @click="Preview('APP')">客户端预览</el-button>
          <el-button size="mini" @click="popClose('FaBuform')">取消</el-button>
          <el-button size="mini" type="primary" @click="popOk('FaBuform')">{{ AddOrUpdate ==
            'update' ? '修改' : '保存' }}</el-button>
        </div>
      </el-dialog>
    </div>
    <!-- 推送对象弹窗 -->
    <el-dialog :show-close="false" :close-on-click-modal="false" @close="popCloseChange('pushObjBtn')" title="推送对象"
      :visible.sync="PushObjectShow" width="1050px">

      <!-- 推送社区 -->
      <div v-if="pushObjType == 'community'">
        <div>
          <el-input style="width: 250px;" v-model="communityKey" placeholder="输入小区名称搜索"></el-input>
          <el-button type="primary" @click="getCommunityData">搜索</el-button>
        </div>
        <el-table ref="elTableCommunity" height="370" @select-all="selectAllCommunity" @select="selectCommunity"
          :data="communityData" border style="width: 100%;margin-top: 20px;">
          <el-table-column type="selection" width="40">
          </el-table-column>
          <el-table-column align="center" prop="name" label="小区姓名">
          </el-table-column>
          <el-table-column align="center" prop="areaName" label="地区">
          </el-table-column>
          <el-table-column align="center" prop="address" label="详细地址">
          </el-table-column>
        </el-table>
      </div>



      <!-- 推送人员/机关/机构 -->
      <div v-else class="PushObjectStyle">
        <!-- 左边树桩选择器 -->
        <div class="left">
          <div style="width:100%;display: flex;">
            <el-input placeholder="请输入搜索内容" v-model="PushObjTreeName">
            </el-input>
            <el-button slot="append" type="primary" icon="el-icon-search" @click="PushObjNameClick"></el-button>
          </div>
          <div class="treeBox">
            <!-- 新增的时候使用，懒加载 -->
            <el-tree :expand-on-click-node="false" :data="treeData" highlight-current @node-click="nodeClick"
              @check="check" node-key="uid" :props="defaultProps" ref="tree" show-checkbox>
            </el-tree>
          </div>
        </div>
        <!-- 右边 -->
        <div class="right">
          <div class="right_top">
            <div class="key" style="width:250px;display: flex;">
              <el-input placeholder="输入关键字" v-model="PushObjTableName">
              </el-input>
              <el-button slot="append" type="primary" icon="el-icon-search" @click="PushObjSouSuo"></el-button>
            </div>
            <el-select style="width: 200px;" clearable @change="PushObjSouSuo" v-model="PushObjTableSex"
              placeholder="根据性别筛选">
              <el-option v-for="item in sexData" :key="item.value" :label="item.label" :value="item.value">
              </el-option>
            </el-select>
            <el-select style="width: 200px;" clearable @change="PushObjSouSuo" v-model="PushObjTableAge"
              placeholder="根据年龄筛选">
              <el-option v-for="item in ageData" :key="item.value" :label="item.label" :value="item.value">
              </el-option>
            </el-select>
          </div>
          <!-- 右边表格 -->
          <div class="right_table">
            <el-table ref="elTable" @select-all="selectAll" @select="TSDXSelect" height="370" :data="pushObjUserData"
              border style="width: 100%">
              <el-table-column type="selection" width="40">
              </el-table-column>
              <el-table-column align="center" prop="name" label="姓名" width="120">
              </el-table-column>
              <el-table-column align="center" prop="account" label="手机号" width="120">
              </el-table-column>
              <el-table-column align="center" prop="gender" label="性别" width="60">

                <template slot-scope="scope">
                  <span>
                    {{ scope.row.gender == '1' ? '男' : '女' }}
                  </span>
                </template>
              </el-table-column>
              <el-table-column align="center" prop="age" label="年龄" width="60">
              </el-table-column>

              <el-table-column v-if="pushObjType == 'appUser'" align="center" prop="roomName" label="住址">
              </el-table-column>
              <el-table-column v-if="pushObjType == 'agency' || pushObjType == 'company'" align="center" prop="deptName"
                label="部门">
              </el-table-column>
              <el-table-column v-if="pushObjType == 'agency' || pushObjType == 'company'" align="center"
                prop="postNamesList" label="岗位">
              </el-table-column>
            </el-table>
          </div>
        </div>
      </div>
      <div class="pushObj_bottom">
        <el-button @click="popClose('pushObjBtn')">取 消</el-button>
        <el-button @click="popOk('pushObjBtn')" type="primary">确 认</el-button>
      </div>
    </el-dialog>

    <!-- 印章弹窗 -->
    <div>
      <el-dialog @close="popCloseChange('sealPop')" title="印章管理" :visible.sync="sealShow" width="400px">
        <el-form label-width="100px">
          <el-form-item label="印章预览：">
            <el-image style="width: 200px; height: 200px" :src="Sealurl" :preview-src-list="SealurlList">
              <div slot="error" style="width: 100%;
              height: 100%;background-color: #f2f2f2;display: flex;justify-content: center;align-items: center;">
                未上传印章
              </div>
            </el-image>
          </el-form-item>
          <el-form-item label="更新印章：">
            <div>
              <el-upload class="upload-demo" ref="upload" action="#" accept=".png,.jpg,.jpeg" :multiple="false"
                :http-request="submitUpload" list-type="text" auto-upload :before-upload="beforeUpload"
                :show-file-list="false">
                <!-- 只有超级管理员才能上传 -->
                <el-button @click="SealUpload" slot="default" type="primary" icon="el-icon-upload2" plain>上传</el-button>
              </el-upload>
              <span style="font-size: 12px;color: #aaa;">支持JPG,JPEG,PNG格式</span>
            </div>
          </el-form-item>
        </el-form>
      </el-dialog>
    </div>
    <!-- 手机端预览弹窗 -->
    <div class="AppStyle" v-if="AppShow">
      <div class="box">
        <div class="close" @click="AppShow = false">关闭</div>
        <div class="top">
          <div></div>
          <div></div>
        </div>
        <div class="mainTop">
          <span>公告详情</span>
        </div>
        <div class="App_main_box" style="position: relative;overflow: scroll;width: 100%;height: 100vh">
          <div class="App_main" style="position:absolute;left:0;top: 0;width: 100%;">

          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import myuploadFBGG from '@/components/myuploadFBGG'
import Richtext from '@/components/Richtext'
import axios from 'axios'
export default {
  components: {
    myuploadFBGG,
    Richtext
  },
  data() {
    return {
      // 推送社区================================
      communityKey: '',
      communityData: [],
      // =====================================推送社区
      DeleteFileData: [],
      scheduleDrop: null,// 审批历史进度点
      files: [],//富文本附件回显

      content: '',
      fileList: [],//附件列表

      //顶部筛选
      typeTime: [],
      keytitle: '',
      // 表格数据
      tableData: [],
      // 发布服务弹窗
      AddOrUpdate: 'add',
      FaBuShow: false,
      FaBuRules: {
        title: [
          { required: true, message: ' ', trigger: 'blur' }
        ],
        // theme: [
        //   { required: true, message: ' ', trigger: 'blur' }
        // ],
        pushCategory: [
          { required: true, message: ' ', trigger: 'change' }
        ],
        regularTimeStr: [
          { required: true, message: ' ', trigger: 'change' }
        ],
        count: [
          { required: true, message: ' ', trigger: 'blur' }
        ],
      },
      FileList: [],

      TZGGShowList: [`${defaultUrl}/image/default/notice/通知公告.png`],//通知公告大图
      FaBuData: {},

      // 印章弹窗
      sealShow: false,
      Sealurl: '',
      SealurlList: [],
      // 移动端预览
      AppShow: false,
      // 分页器
      total: 1,
      pageNum: 1,
      pageSize: 10,

      isSeal: '',//是否选择了印章
      statusList: ['未提交', '待发布', '审核中', '已发布', '已驳回', '发送失败'],
      RichtextShow: false,
      updateActiveObj: null,

      DetailRes: {},//详情信息  可以判断是否更改了
      activeRow: '',//当前所在行内容
      SealId: '',
      IsSuperAdmin: null,
      logOnUser: {},
      oldImg: '',//主题图暂存
      beforePushObjType: '', //切换推送类型之前的类型
      // 推送对象=====================================
      pushObjType: '',
      PushObjectShow: false,//推送对象弹窗显隐
      activeTree: [// 选中的tree数据
        { type: 'appUser', list: [] },
        { type: 'agency', list: [] },
        { type: 'company', list: [] },
      ],
      activeUser: [// 推送的激活类型和所有激活的人
        { type: 'appUser', list: [] },
        { type: 'agency', list: [] },
        { type: 'company', list: [] },
        { type: 'community', list: [] },
      ],
      clickTreeObj: '',//当前点击或者激活的tree项 用来获取右侧人员列表
      pushObjUserData: [
      ], //推送对象的人员数据
      PushObjTableSex: '',//性别筛选
      PushObjTableAge: '',//年龄筛选
      PushObjTableName: '',//推送对象右边表格筛选
      sexData: [  //性别数据
        { label: '女', value: '0' },
        { label: '男', value: '1' }
      ],
      ageData: [//年龄数据
        { label: '0-10岁', value: '0-10' },
        { label: '10岁-20岁', value: '10-20' },
        { label: '20岁-30岁', value: '20-30' },
        { label: '30岁-40岁', value: '30-40' },
        { label: '40岁-50岁', value: '40-50' },
        { label: '50岁以上', value: '50-200' }
      ],
      treeData: [],
      defaultProps: {
        label: 'name',
        value: 'id',
        isLeaf: 'leaf'
      },
      PushObjTreeName: '',//推送对象名称查询tree
      // ============================================推送对象
    }
  },
  async activated() {
    this.logOnUser = JSON.parse(sessionStorage.getItem('logOnUser'))
    this.typeTime = ''
    this.keytitle = ''
    this.isSeal = '不盖章'

    this.communityKey = ''
    this.getCommunityData()
    this.getTableList()
    this.getSeal()
    this.getIsSuperAdmin() //验证是否是超级管理员
  },
  deactivated() {

  },
  methods: {

    // 推送社区=========================================
    async getCommunityData() {

      let res = await this.$api.events.getCellList({
        "name": this.communityKey,
        pageNum: 1,
        pageSize: 10000,
        roleIds: this.logOnUser.roleIds
      })
      this.communityData = res.data.list
    },
    selectCommunity(selection, row) { //社区单选
      console.log(selection, row, '社区单选');
      let selected = selection.length && selection.indexOf(row) !== -1 //判断是激活还是取消激活
      if (selected) {
        this.activeUser.forEach(activeEl => { //找到激活人员的list
          if (this.pushObjType == activeEl.type) {
            if (!activeEl.list.includes(row.id)) { //找到这个元素，添加
              activeEl.list.push(row.id)
            }
          }
        })
      } else {
        this.activeUser.forEach(activeEl => { //找到激活人员的list
          if (this.pushObjType == activeEl.type) {
            activeEl.list.forEach((el, i) => {
              if (el == row.id) { //找到这个元素，添加
                activeEl.list.splice(i, 1)
              }
            })
          }
        })
      }
    },
    selectAllCommunity(selection) {
      if (selection.length > 0) {
        let arr = [] //获取选中的人员id数组
        this.communityData.forEach((el, i) => {
          arr.push(el.id)
        })
        this.activeUser.forEach(activeEl => { //找到激活人员的list
          if (this.pushObjType == activeEl.type) {
            for (let element of arr) { // 验重添加
              if (!activeEl.list.includes(element)) {
                activeEl.list.push(element);
              }
            }
          }
        })
      } else {
        this.activeUser.forEach(activeEl => { //找到激活人员的list
          if (this.pushObjType == activeEl.type) {
            activeEl.list = []
          }
        })
      }
    },

    // ============================================推送社区


    async AddClick() { //发布按钮
      let res = await this.$api.message.mygetUserMainDepartment()
      if (Object.keys(res.data).length === 0) { //如果没有主部门
        this.$message.error('当前账号无主部门，无法新增')
        return
      } else {
        this.$set(this.FaBuData, 'departmentId', res.data.departmentId)
      }
      this.isSeal = '不盖章'
      this.DeleteFileData = []
      this.AddOrUpdate = 'add' //发布公告状态
      this.FaBuShow = true
      this.files = [] //附件清空
      this.RichtextShow = true
      this.$set(this.FaBuData, 'image', defaultUrl + '/image/default/notice/通知公告.png')
      this.TZGGShowList = [`${defaultUrl}/image/default/notice/通知公告.png`]//通知公告大图
      this.$nextTick(() => {
        this.$refs.Richtext.clear() //清空富文本内容
        this.$set(this.FaBuData, 'pushCategory', '')
        this.$set(this.FaBuData, 'regularTimeStr', '')
        this.isSeal = '不盖章'
        this.$set(this.FaBuData, 'title', '')
        this.$set(this.FaBuData, 'theme', '')
        this.$set(this.FaBuData, 'pushAnnex', '')
        this.$set(this.FaBuData, 'characters', '')
        this.$set(this.FaBuData, 'years', '')
        this.$set(this.FaBuData, 'number', '')
        this.$set(this.FaBuData, 'count', 0)
        this.pushObjType = ''
        this.activeTree = [// 选中的tree数据
          { type: 'appUser', list: [] },
          { type: 'agency', list: [] },
          { type: 'company', list: [] },
        ]
        this.activeUser = [// 推送的激活类型和所有激活的人
          { type: 'appUser', list: [] },
          { type: 'agency', list: [] },
          { type: 'company', list: [] },
          { type: 'community', list: [] },
        ]
        setTimeout(() => {
          this.$refs['FaBuform'].clearValidate()
        }, 100)
      })
      // 清空数据


    },

    async BtnClick(formName, row) { //表格三按钮
      console.log(row, '点击所在行');
      this.activeRow = row //当前所在行的内容
      switch (formName) {

        case 'XQform': //点击详情
          let DetailRes = await this.$api.message.MygetNoticeDetail(row.id)
          console.log(DetailRes, 'DetailRes');
          if (DetailRes.code != 200) {
            this.$message.error(DetailRes.message)
            return
          }
          this.DeleteFileData = []
          this.AddOrUpdate = 'update' //发布公告状态
          this.FaBuShow = true
          this.TZGGShowList = []

          this.DetailRes = DetailRes.data
          this.FaBuData = DetailRes.data
          this.TZGGShowList.push(DetailRes.data.image)
          if (DetailRes.data.sealId == 0) { //盖章回显
            this.isSeal = '不盖章'
          } else {
            this.isSeal = '盖章'
          }

          if (this.FaBuData.years == 0) { //这两个字段，是type为number类型，需要设置为undefined才会为默认空
            this.$set(this.FaBuData, 'years', undefined)
          }
          if (this.FaBuData.number == 0) {
            this.$set(this.FaBuData, 'number', undefined)
          }



          this.files = [] // 附件回显
          if (DetailRes.data.pushAnnex) {
            // 回显附件
            this.files = JSON.parse(DetailRes.data.pushAnnex)
          }

          // 回显审批历史点
          for (let i = 0; i < DetailRes.data.scheduleList.length; i++) {
            if (DetailRes.data.scheduleList[i].result == '未到审核流程' && DetailRes.data.scheduleList[i].name != 'begin') {
              this.scheduleDrop = i * 1
              break
            } else {
              this.scheduleDrop = i * 1 + 1
            }
          }

          // 推送对象回显==================================
          // 处理推送类型
          switch (DetailRes.data.pushRange) {
            case 1:
              this.pushObjType = 'appUser'
              break
            case 2:
              this.pushObjType = 'agency'
              break
            case 3:
              this.pushObjType = 'company'
              break
            case 0:
              this.pushObjType = 'community'
              break
          }
          this.activeTree = [// 选中的tree数据
            { type: 'appUser', list: [] },
            { type: 'agency', list: [] },
            { type: 'company', list: [] },
          ]
          this.activeUser = [// 推送的激活类型和所有激活的人
            { type: 'appUser', list: [] },
            { type: 'agency', list: [] },
            { type: 'company', list: [] },
            { type: 'community', list: [] },
          ]

          if (DetailRes.data.pushObjects && JSON.parse(DetailRes.data.pushObjects).length > 0) { //如果pushObjects字段有数据，那说明是小区 机关 机构的

            this.activeTree.forEach(el => {
              if (el.type == JSON.parse(DetailRes.data.pushObjects)[0].type) {
                el.list = JSON.parse(DetailRes.data.activeObj)
              }
            })
            this.activeUser.forEach(el => {
              if (el.type == JSON.parse(DetailRes.data.pushObjects)[0].type) {
                el.list = JSON.parse(DetailRes.data.pushObjects)[0].list
              }
            })
          } else { //如果是社区的话 把社区字段赋值
            if (DetailRes.data.toCommunityIds) {
              this.activeUser.forEach(el => {
                if (el.type == this.pushObjType) {
                  el.list = JSON.parse(DetailRes.data.toCommunityIds)
                }
              })
            }

          }
          //================================== 推送对象回显


          let abc = JSON.parse(DetailRes.data.pushDescription)
          // 找到结束位置（不包括）</div class="boxTop">  
          let endIndexBoxTop = abc.indexOf('</div class="boxTop">') + '</div class="boxTop">'.length;

          // 确保我们找到了boxTop的结束标签  
          if (endIndexBoxTop !== -1) {
            // 截取boxTop结束标签之后的所有内容  
            let afterBoxTop = abc.substring(endIndexBoxTop);

            // 在截取后的内容中找到<div class="boxBottom"的开始位置  
            let startIndexBoxBottom = afterBoxTop.indexOf('<div class="boxBottom"');

            // 确保我们找到了boxBottom的开始标签  
            if (startIndexBoxBottom !== -1) {
              // 截取boxBottom开始标签之前的内容  
              let beforeBoxBottom = afterBoxTop.substring(0, startIndexBoxBottom);

              // 将截取的两部分拼接起来得到最终的结果  
              let result = afterBoxTop.substring(0, startIndexBoxBottom);
              this.content = result
            } else {
              // 如果没有找到boxBottom开始标签，则直接输出afterBoxTop（即boxTop之后的所有内容）  
              this.content = afterBoxTop
            }
          } else {
            // 如果没有找到boxTop结束标签，则输出原始字符串（这通常表示原始字符串格式有误）  
            this.content = abc
          }
          this.RichtextShow = true


          this.$nextTick(() => {
            this.$refs['FaBuform'].clearValidate()
          })
          break




        case 'FaBuform'://点击发布
          // if (row.status == 2) return

          if (!row.checkRelease) { //不可发布
            return
          }
          this.$confirm('请确认信息填写无误，经审核流程后将会发布此条公告，是否提交审核？', '发布公告', {
            confirmButtonText: '确认',
            cancelButtonText: '取消',
            type: 'warning'
          }).then(async () => {
            let res = await this.$api.message.MysubmitApproval({
              "noticeId": row.id,
              "noticeTitle": row.title, //公告标题
              "noticeType": "public" //公告审批类型: public:公告发布审批 update:公告修改类型
            })
            console.log(res, '审批接口');
            if (res.code == 200) {
              this.$message({
                message: '提交成功',
                type: 'success'
              });
              this.getTableList()
            } else {
              this.$message.error(res.message)
            }
          }).catch(() => {
          });
          break




        case 'delete'://点击删除

          if (!row.checkDelete) {
            this.$message.error('无法删除')
            return
          }
          this.$confirm('此操作将会删除此条公告内容，是否继续？', '删除公告', {
            confirmButtonText: '确认',
            cancelButtonText: '取消',
            type: 'warning'
          }).then(async () => {
            let res = await this.$api.message.MydeleteNotice({
              id: row.id
            })
            if (res.code == 200) {
              this.$message({
                message: '删除成功',
                type: 'success'
              });
              this.getTableList()
            }
          }).catch(() => {
          });
          break
      }

    },
    async popOk(formName) { //弹窗确认接口
      switch (formName) {
        //================================详情弹窗
        case 'XQform':


          break


        //================================公告发布
        case 'FaBuform':

          console.log(this.activeRow, 'this.activeRow');

          for (let i = 0; i < this.activeUser.length; i++) {
            if (this.activeUser[i].type == this.pushObjType) {
              if (this.activeUser[i].list.length == 0) {
                this.$message.error('请选择推送对象')
                return
              }
            }
          }

          if (!this.activeRow.checkUpdate && this.AddOrUpdate == 'update') { //审核中无法修改
            switch (this.activeRow.status) {
              case 0:
                this.$message.error('此公告非本人创建，无法修改')
                return
              case 1:
                this.$message.error('公告审核完毕，无法修改')
                return
              case 2:
                this.$message.error('公告正在审核中，无法修改')
                return
              case 3:
                this.$message.error('公告审核完毕，无法修改')
                return
            }
            return
          }
          this.$refs[formName].validate(async (valid) => {
            if (valid) {
              if (this.FaBuData.image == '') {
                this.$message.error('请上传主题图')
                return
              }



              //登录用户信息
              this.$set(this.FaBuData, 'unitType', this.logOnUser.unitType)

              this.$set(this.FaBuData, 'unitId', this.logOnUser.unitId)

              // 富文本附件
              if (this.FaBuData.pushAnnex == '[]' || this.FaBuData.pushAnnex == undefined) {
                this.$set(this.FaBuData, 'pushAnnex', '')
              }

              // 推送内容最外层盒子
              let box = `<div style="transform-origin:0 0;width:100%;background: white;margin: 0 auto;position: relative;min-height: 500px;">`
              // 处理推送内容的top盒子 标题  年 字 号
              let boxTop;
              if (this.FaBuData.characters && this.FaBuData.years && this.FaBuData.number && this.FaBuData.theme) { //全都有
                boxTop = `<div class="top" style="display: flex;flex-direction: column;align-items: center;"><div style="color: red;margin: 20px 0;font-size: 30px;font-family: cursive;">${this.FaBuData.title}</div><div>${this.FaBuData.characters}（${this.FaBuData.years}）${this.FaBuData.number}号</div><div style="width: 100%;height: 2px;background-color: red;"></div><div style="color: black;margin: 20px 0;font-size: 22px;font-weight: 600;">${this.FaBuData.theme}</div></div class="boxTop">`
              } else if (this.FaBuData.characters && this.FaBuData.years && this.FaBuData.number && !this.FaBuData.theme) { //有标题 年字号 没主题词
                boxTop = `<div class="top" style="display: flex;flex-direction: column;align-items: center;"><div style="color: red;margin: 20px 0;font-size: 30px;font-family: cursive;">${this.FaBuData.title}</div><div>${this.FaBuData.characters}（${this.FaBuData.years}）${this.FaBuData.number}号</div><div style="width: 100%;height: 2px;background-color: red;"></div></div class="boxTop">`
              } else if (!(this.FaBuData.characters && this.FaBuData.years && this.FaBuData.number) && this.FaBuData.theme) { //没年自号 有标题有主题词
                boxTop = `<div class="top" style="display: flex;flex-direction: column;align-items: center;"><div style="color: red;margin: 20px 0;font-size: 30px;font-family: cursive;">${this.FaBuData.title}</div><div style="width: 100%;height: 2px;background-color: red;"></div><div style="color: black;margin: 20px 0;font-size: 22px;font-weight: 600;">${this.FaBuData.theme}</div></div class="boxTop">`
              } else { //只有标题
                boxTop = `<div class="top" style="display: flex;flex-direction: column;align-items: center;"><div style="color: red;margin: 20px 0;font-size: 30px;font-family: cursive;">${this.FaBuData.title}</div><div style="width: 100%;height: 2px;background-color: red;"></div></div class="boxTop">`
              }
              // 处理推送内容的bottom盒子 附件 印章
              let boxBottom;
              if (!this.FaBuData.pushAnnex) { //没有附件的情况下
                if (this.isSeal == '盖章') { //没附件 有盖章
                  this.$set(this.FaBuData, 'sealId', this.SealId) // 盖章 获取它的id
                  boxBottom = `<div class="boxBottom"><img style=" position: absolute;bottom: 50px;right: 20px;width: 100px;height: 100px;" src="${this.Sealurl}"></div>`
                } else if (this.isSeal == '不盖章') { //既没附件  又没盖章
                  this.$set(this.FaBuData, 'sealId', 0) //不盖章传0
                  boxBottom = `<div class="boxBottom"></div>`
                }
              } else {//有附件的情况下
                let pushAnnexList = JSON.parse(this.FaBuData.pushAnnex)
                let annexData = ''
                pushAnnexList.forEach(el => {
                  // annexData += `<span style="color:black" >${el.name}</span>`
                  // annexData += `<a style="color:black" href="${defaultUrl}/business/notice/downloadAnnex?filename=${el.url}&account=${this.logOnUser.account}&token=${this.logOnUser.token}" target="_blank">${el.name}</a>`
                  annexData += `<a style="color:black" href="${defaultUrl}/business/notice/downloadAnnex?filename=${el.url}&key=quich@123" target="_blank">${el.name}</a>`

                })
                let AnnexBox = `<div class="boxBottom"  style="margin-top:50px;display: flex;align-items: center;"><span>附件列表：</span><span style="display: flex;flex-direction: column;">${annexData}</span></div>`
                if (this.isSeal == '盖章') { //有附件 有盖章
                  this.$set(this.FaBuData, 'sealId', this.SealId) // 盖章 获取它的id
                  let SealImg = `<img style=" position: absolute;bottom: 50px;right: 20px;width: 100px;height: 100px;" src="${this.Sealurl}">`
                  boxBottom = AnnexBox + SealImg
                } else if (this.isSeal == '不盖章') { //有附件  没盖章
                  this.$set(this.FaBuData, 'sealId', 0) //不盖章传0
                  boxBottom = AnnexBox
                }
              }
              this.$set(this.FaBuData, 'pushDescription', JSON.stringify(box + boxTop + this.content + boxBottom + `</div>`)) //富文本内容

              // 处理推送类型
              switch (this.pushObjType) {
                case 'appUser':
                  this.$set(this.FaBuData, 'pushRange', 1)
                  break
                case 'agency':
                  this.$set(this.FaBuData, 'pushRange', 2)
                  break
                case 'company':
                  this.$set(this.FaBuData, 'pushRange', 3)
                  break
                case 'community':
                  this.$set(this.FaBuData, 'pushRange', 0)
                  break
              }
              // 处理推送树结构和人群
              switch (this.pushObjType) {
                case 'appUser':
                case 'agency':
                case 'company':
                  this.$set(this.FaBuData, 'type', 'people')
                  this.$set(this.FaBuData, 'toCommunityIds', JSON.stringify([]))
                  this.activeTree.forEach(activeEl => {
                    if (this.pushObjType == activeEl.type) {
                      this.$set(this.FaBuData, 'activeObj', JSON.stringify(activeEl.list)) //activeObj  树结构
                    }
                  })
                  this.activeUser.forEach(activeEl => {
                    if (this.pushObjType == activeEl.type) {
                      this.$set(this.FaBuData, 'pushObjects', JSON.stringify([
                        { type: this.pushObjType, list: activeEl.list }
                      ]))
                    }
                  })
                  break
                case 'community':
                  this.$set(this.FaBuData, 'activeObj', JSON.stringify([]))
                  this.$set(this.FaBuData, 'pushObjects', JSON.stringify([]))

                  this.$set(this.FaBuData, 'type', 'community')
                  this.activeUser.forEach(activeEl => {
                    if (this.pushObjType == activeEl.type) {
                      this.$set(this.FaBuData, 'toCommunityIds', JSON.stringify(activeEl.list))
                    }
                  })
                  break
              }




              this.$set(this.FaBuData, 'pushSummary', this.getChinese(this.FaBuData.pushDescription))

              // 新增还是修改???
              switch (this.AddOrUpdate) {
                case 'add':
                  this.$confirm('请检查无误后提交！', '提示', {
                    confirmButtonText: '确定',
                    cancelButtonText: '取消',
                    type: 'warning'
                  }).then(() => {

                    this.$set(this.FaBuData, 'status', 0)// 状态

                    let Addparams = {
                      "title": this.FaBuData.title ? this.FaBuData.title : '', //标题
                      "sealId": this.FaBuData.sealId ? this.FaBuData.sealId : '', //印章id
                      "theme": this.FaBuData.theme ? this.FaBuData.theme : '', //主题
                      "characters": this.FaBuData.characters ? this.FaBuData.characters : '', //字，限制10个字
                      "years": this.FaBuData.years ? this.FaBuData.years : '', //年，数字
                      "number": this.FaBuData.number ? this.FaBuData.number : '', //号，数字
                      "pushCategory": this.FaBuData.pushCategory ? this.FaBuData.pushCategory : '', //推送方式：1立即，2定时
                      "regularTimeStr": this.FaBuData.regularTimeStr ? this.FaBuData.regularTimeStr : '', //定时推送时间
                      "pushRange": this.FaBuData.pushRange ? this.FaBuData.pushRange : '', //推送范围:1小区，2机关机构
                      "pushSummary": this.FaBuData.pushSummary,
                      "count": this.FaBuData.count ? this.FaBuData.count : '', //显示人数
                      "image": this.FaBuData.image ? this.FaBuData.image : '', //主题图url
                      "pushDescription": this.FaBuData.pushDescription ? this.FaBuData.pushDescription : '', //推送内容
                      "pushAnnex": this.FaBuData.pushAnnex ? this.FaBuData.pushAnnex : '', //推送内容附件
                      "unitType": this.FaBuData.unitType ? this.FaBuData.unitType : '', //发文单位分类：机关agency，机构company
                      "unitId": this.FaBuData.unitId, //发文单位id
                      "departmentId": this.FaBuData.departmentId, //部门id
                      "status": this.FaBuData.status ? this.FaBuData.status : '',
                      "pushObjects": this.FaBuData.pushObjects ? this.FaBuData.pushObjects : '', //推送对象的树结构
                      "activeObj": this.FaBuData.activeObj ? this.FaBuData.activeObj : '', //推送对象的所有人
                      "type": this.FaBuData.type ? this.FaBuData.type : '',
                      "toCommunityIds": this.FaBuData.toCommunityIds ? this.FaBuData.toCommunityIds : '',

                    }
                    this.$api.message.MyinsertNotice(Addparams).then(res => {
                      console.log(res, '内容');
                      if (res.code == 200) {
                        this.$message({
                          message: '新增成功',
                          type: 'success'
                        });
                        this.FaBuShow = false
                        this.getTableList()
                      }

                    })
                  })

                  break
                case 'update':
                  this.$set(this.FaBuData, 'status', 0)// 状态

                  let {
                    id, title, sealId, count, theme, characters, years, number, pushCategory, regularTimeStr, pushSummary
                    , pushRange, image, pushDescription, unitType, unitId, departmentId, pushAnnex, userId, pushObjects, activeObj, type, toCommunityIds
                  } = this.FaBuData

                  let params = {
                    id, title, sealId, count, theme, characters, years, number, pushCategory, regularTimeStr, pushSummary
                    , pushRange, image, pushDescription, unitType, unitId, departmentId, pushAnnex, userId, pushObjects, activeObj, type, toCommunityIds
                  }
                  let equation = true;
                  if (params.years == undefined) {
                    params.years = 0
                  }
                  if (params.number == undefined) {
                    params.number = 0
                  }
                  let DetailRes = await this.$api.message.MygetNoticeDetail(id)
                  for (let a in DetailRes.data) {
                    for (let b in params) {
                      if (a == b) {
                        if (DetailRes.data[a] == params[b]) {

                        } else {
                          equation = false
                        }
                      }
                    }
                  }
                  if (equation) { //如果没更改过
                    this.FaBuShow = false
                    this.getTableList()
                    return
                  } else {
                    this.$confirm('内容已更新,是否保存当前内容?', '修改公告', {
                      confirmButtonText: '确定',
                      cancelButtonText: '取消',
                      type: 'warning'
                    }).then(async () => {
                      // 检测是否更改过
                      console.log(this.FaBuData, '修改的数据');

                      if (this.oldImg) {
                        let res = await this.$api.message.MyindeleteImg({
                          "picName": this.oldImg
                        })
                        console.log(res, '删除图片');
                      }

                      let userData = JSON.parse(sessionStorage.getItem('logOnUser'))
                      this.DeleteFileData.forEach(el => { //删除附件
                        let params = {
                          "filename": el.url
                        }
                        axios({
                          method: 'post',
                          url: defaultUrl + '/business/notice/deleteAnnex', //此处为往后台发送请求的地址
                          data: params,
                          headers: {
                            account: userData.account,
                            token: userData.token,
                          },
                          timeout: 20000,
                        }).then(res => {
                        });
                      })

                      this.$api.message.MyupdateNotice(params).then(res => {
                        console.log(res, '内容');
                        if (res.code == 200) {
                          this.$message({
                            message: '修改成功',
                            type: 'success'
                          });
                          this.FaBuShow = false
                          this.getTableList()
                        }
                      })
                    }).catch(() => {

                    });
                  }

                  break
              }

            } else {
              console.log('error submit!!');
              return false;
            }
          });
          break

        //=============================推送对象
        case 'pushObjBtn':

          // // 目前被选中的菜单节点
          // this.activeTree.forEach(el => {
          //   if (el.type == this.pushObjType) {
          //     
          //     el.list = this.$refs.tree.getCheckedKeys();
          //   }
          // })

          this.PushObjectShow = false
          this.activeUser.forEach(el => {
            if (el.type == this.pushObjType) {
              this.$set(this.FaBuData, 'count', el.list.length)
            }
          })
          console.log(this.activeTree, this.activeUser, '最终确认推送数据');
          break

      }
    },
    popClose(formName) { //弹窗取消按钮
      switch (formName) {

        //================================详情弹窗
        case 'XQform':

          break

        //================================公告发布
        case 'FaBuform':
          this.FaBuShow = false
          break

        //=============================推送对象
        case 'pushObjBtn':
          this.PushObjectShow = false
          this.pushObjType = this.beforePushObjType
          break
      }
    },
    popCloseChange(formname) { // 弹窗每次关闭时的函数
      switch (formname) {
        case 'XQform': //预览详情

          break
        case 'FaBuform': //公告发布
          this.RichtextShow = false
          break
        case 'pushObjBtn': //推送对象弹窗

          // 将推送对象的所有筛选项清空
          this.PushObjTableSex = ''
          this.PushObjTableAge = ''
          this.PushObjTableName = ''
          this.PushObjTreeName = ''

          break
        case 'sealPop':
          if (this.Sealurl == '') {
            this.isSeal = '不盖章'
          }
          break
      }
    },

    PushObjNameClick() { //树节点筛选搜索框的点击事件
      // this.PushObjTreeName
      this.pushObjUserData = []
      this.pushObjTypeChange()
    },

    async pushObjTypeChange() {  //重新选择推送类型时
      this.$nextTick(() => {
        this.$refs['FaBuform'].clearValidate()
      })
      this.PushObjectShow = true
      this.pushObjUserData = []
      // 获取tree数据 ===========================
      if (this.pushObjType == 'appUser') { // 获取小区tree数据
        let res = await this.$api.message.MyGetInfoListForMessage({
          name: this.PushObjTreeName
        })
        if (res.code == 200) {
          this.treeData = res.data
        } else {
          this.$message.error(res.message)
        }
      } else if (this.pushObjType == 'agency') {
        let res = await this.$api.message.MyGetAgencyListForMessage(this.logOnUser.unitId, this.PushObjTreeName, this.logOnUser.unitType)
        if (res.code == 200) {
          this.treeData = res.data
        } else {
          this.$message.error(res.message)
        }
      } else if (this.pushObjType == 'company') {
        let res = await this.$api.message.MyGetCompanyListForMessage(this.logOnUser.unitId, this.PushObjTreeName, this.logOnUser.unitType)
        if (res.code == 200) {
          this.treeData = res.data
        } else {
          this.$message.error(res.message)
        }
      } else if (this.pushObjType == 'community') {

        this.activeUser.forEach(activeEl => {
          if (this.pushObjType == activeEl.type) {
            this.communityData.forEach((el, i) => {
              activeEl.list.forEach(ell => {
                if (el.id == ell) {
                  this.$nextTick(() => {
                    this.$refs.elTableCommunity.toggleRowSelection(this.communityData[i], true)
                  })
                }
              })
            })
          }
        })
      }
      // ===========================  获取tree数据 
      this.$nextTick(() => { //点亮tree数据
        this.activeTree.forEach(el => {
          if (el.type == this.pushObjType) {
            el.list.forEach(ell => {
              this.$refs.tree.setChecked(ell, true);
            })
          }
        })
      })
    },

    async ClickTreeGetTableUser() {
      if (this.pushObjType == 'appUser') {
        let params = {
          "gender": this.PushObjTableSex, //性别，1男0女
          "ageInterval": this.PushObjTableAge, //年龄间隔
          "keywords": this.PushObjTableName, //关键字
          "roomId": 0, //房间id
          "buildingId": 0, //楼宇id
          "residentialId": 0, //小区id
          "pageNum": 1,
          "pageSize": 100000
        }
        // 根据 clickTreeObj 查看type
        switch (this.clickTreeObj.type) {
          case 'residential':
            params.residentialId = this.clickTreeObj.id
            break
          case 'building':
            params.buildingId = this.clickTreeObj.id
            break
          case 'room':
            params.roomId = this.clickTreeObj.id
            break
        }
        let res = await this.$api.message.MygetUserListByParams(params)
        console.log(res, '推送对象表格数据');
        return res.data.list

      } else if (this.pushObjType == 'agency' || this.pushObjType == 'company') {
        let params = {
          "gender": this.PushObjTableSex, //性别，1男0女
          "ageInterval": this.PushObjTableAge, //年龄间隔
          "keywords": this.PushObjTableName, //关键字
          "unitType": 0, //机关1，机构2
          "unitId": 0, //组织id
          "deptId": 0, //部门id
          "pageNum": 1,
          "pageSize": 100000
        }
        switch (this.pushObjType) {
          case 'agency': //查所有机关 人员
            params.unitType = 'agency'
            if (this.clickTreeObj.type == 'agency') {
              params.unitId = this.clickTreeObj.id
              params.deptId = 0
            }
            if (this.clickTreeObj.type == 'department') {
              params.unitId = 0
              params.deptId = this.clickTreeObj.id
            }
            break
          case 'company'://查所有机构 人员
            params.unitType = 'company'
            if (this.clickTreeObj.type == 'company') {
              params.unitId = this.clickTreeObj.id
              params.deptId = 0
            }
            if (this.clickTreeObj.type == 'department') {
              params.unitId = 0
              params.deptId = this.clickTreeObj.id
            }
            break

        }
        let res = await this.$api.message.MygetOrganizationByParams(params)
        console.log(res, '点击的当前人员');
        return res.data.list
      }
    },
    PushObjSouSuo() { //推送对象的右边表格筛选
      // this.PushObjTableName 名字
      // PushObjTableSex  性别
      // PushObjTableAge  年龄
      this.ClickTreeGetTableUser().then(res => {
        this.pushObjUserData = []
        console.log(res);
        switch (this.pushObjType) {
          case 'appUser':
            res.forEach(el => {
              this.pushObjUserData.push({
                name: el.name,
                account: el.account,
                gender: el.gender,
                age: el.age,
                roomName: el.roomName,
                id: el.id,
                residentialId: el.residentialId,
                buildingId: el.buildingId,
                roomId: el.roomId,
              },)
            })
            break
          case 'agency':
          case 'company':
            console.log(res, '机关机构选中的人');
            res.forEach(el => {
              this.pushObjUserData.push({
                name: el.name,
                account: el.account,
                gender: el.gender,
                age: el.age,
                deptName: el.deptName,
                id: el.id,
                postNamesList: el.postNamesList.join(','),
                unitType: el.unitType,
                unitId: el.unitId,
                unitDeptId: el.unitDeptId,
              },)
            })
            break

        }
        this.activeUser.forEach(activeEl => {
          if (this.pushObjType == activeEl.type) {
            this.pushObjUserData.forEach((el, i) => {
              activeEl.list.forEach(ell => {
                if (el.id == ell) {
                  this.$nextTick(() => {
                    this.$refs.elTable.toggleRowSelection(this.pushObjUserData[i], true)
                  })
                }
              })
            })
          }
        })

      })
    },
    addIfNotExists(array, element) {
      // 使用indexOf方法来检查元素是否存在于数组中  
      if (array.indexOf(element) === -1) {
        // 如果indexOf返回-1，说明元素不在数组中，所以添加它  
        array.push(element);
      }
    },
    removeIfExistsInPlace(array, element) {
      let index = array.indexOf(element);

      // 当找到元素时，使用splice方法移除它  
      while (index !== -1) {
        array.splice(index, 1);
        // 再次查找，因为splice会改变数组  
        index = array.indexOf(element);
      }
    },
    nodeClick(a, b, c) { //tree点击

      console.log(a, b, c, 'tree点击');
      this.clickTreeObj = a
      this.ClickTreeGetTableUser().then(res => {
        this.pushObjUserData = res
        console.log(this.pushObjUserData, '当前的人员列表');

        this.activeUser.forEach(activeEl => {
          if (this.pushObjType == activeEl.type) {
            this.pushObjUserData.forEach((el, i) => {
              activeEl.list.forEach(ell => {
                if (el.id == ell) {
                  this.$nextTick(() => {
                    this.$refs.elTable.toggleRowSelection(this.pushObjUserData[i], true)
                  })
                }
              })
            })
          }
        })
      })
    },
    async check(a, b) { //tree点击激活项事件
      console.log(a, b, 'qwdqwqfe')

      this.clickTreeObj = a
      let selected = b.checkedKeys.indexOf(a.uid) > -1//判断是激活还是取消激活
      if (selected) { //如果是激活

        // 处理树结构
        this.activeTree.forEach(el => {
          if (el.type == this.pushObjType) {
            this.addIfNotExists(el.list, a.uid)
          }
        })

        this.ClickTreeGetTableUser().then(res => {
          this.pushObjUserData = res
          console.log(this.pushObjUserData, '当前的人员列表');

          let arr = [] //获取选中的人员id数组
          this.pushObjUserData.forEach((el, i) => { //使表格全部激活
            this.$nextTick(() => {
              this.$refs.elTable.toggleRowSelection(this.pushObjUserData[i], true)
            })
            arr.push(el.id)
          })

          this.activeUser.forEach(activeEl => { //找到激活人员的list
            if (this.pushObjType == activeEl.type) {
              for (let element of arr) { // 验重添加激活人员
                if (!activeEl.list.includes(element)) {
                  activeEl.list.push(element);
                }
              }
            }
          })
          console.log(this.activeUser, 'tree点击激活最终列表');
        })
      }
      if (!selected) {//如果是取消激活
        // 处理树结构
        this.activeTree.forEach(el => {
          if (el.type == this.pushObjType) {
            this.removeIfExistsInPlace(el.list, a.uid)
          }
        })
        this.ClickTreeGetTableUser().then(res => {
          this.pushObjUserData = res
          console.log(this.pushObjUserData, '当前的人员列表');

          let arr = [] //获取选中的人员id数组
          this.pushObjUserData.forEach((el, i) => {
            this.$nextTick(() => {
              this.$refs.elTable.toggleRowSelection(this.pushObjUserData[i], false)
            })
            arr.push(el.id)
          })

          this.activeUser.forEach(activeEl => { //找到激活人员的list
            if (this.pushObjType == activeEl.type) { //把取消人员全部去除
              activeEl.list = activeEl.list.filter(element => !arr.includes(element));
            }
          })
          console.log(this.activeUser, 'tree点击激活最终列表');
        })

      }

    },
    TSDXSelect(selection, row) {//表格单选事件
      console.log(selection, row, '单选');
      let selected = selection.length && selection.indexOf(row) !== -1 //判断是激活还是取消激活
      if (selected) { //如果是激活
        this.activeUser.forEach(activeEl => { //找到激活人员的list
          if (this.pushObjType == activeEl.type) {
            if (!activeEl.list.includes(row.id)) { //找到这个元素，添加
              activeEl.list.push(row.id)
            }
          }
        })
        let addTreeUid = null;
        switch (this.pushObjType) {
          case 'appUser':
            this.$refs.tree.setChecked(row.roomId, true);
            addTreeUid = row.roomId
            break
          case 'agency':
            // 有时候机关机构没有部门，那么就判断激活的clickTreeObj的children存在或者是长度大于零来判断有没有部门  然后拼type和id的uid来进行点亮
            if (this.clickTreeObj.type == 'agency') { //点击机关
              if (this.clickTreeObj.children) { //如果有chilren字段，就说明有部门
                this.$refs.tree.setChecked('department' + row.unitDeptId, true);

                addTreeUid = 'department' + row.unitDeptId
              } else { //如果没有部门，机关亮
                this.$refs.tree.setChecked('agency' + row.unitId, true);
                addTreeUid = 'agency' + row.unitId
              }
            } else { //点击部门，直接部门亮
              this.$refs.tree.setChecked('department' + row.unitDeptId, true)
              addTreeUid = 'department' + row.unitDeptId

            }

            break
          case 'company':
            if (this.clickTreeObj.type == 'company') { //点击机关
              if (this.clickTreeObj.children) { //如果有chilren字段，就说明有部门
                this.$refs.tree.setChecked('department' + row.unitDeptId, true);
                addTreeUid = 'department' + row.unitDeptId
              } else { //如果没有部门，机关亮
                this.$refs.tree.setChecked('company' + row.unitId, true);
                addTreeUid = 'company' + row.unitId
              }
            } else { //点击部门，直接部门亮
              this.$refs.tree.setChecked('department' + row.unitDeptId, true)
              addTreeUid = 'department' + row.unitDeptId
            }
            break

        }
        // 处理树结构
        this.activeTree.forEach(el => {
          if (el.type == this.pushObjType) {
            this.addIfNotExists(el.list, addTreeUid)
          }
        })
      }
      if (!selected) { //如果是取消激活
        this.activeUser.forEach(activeEl => { //找到激活人员的list
          if (this.pushObjType == activeEl.type) {
            activeEl.list.forEach((el, i) => {
              if (el == row.id) { //找到这个元素，添加
                activeEl.list.splice(i, 1)
              }
            })
          }
        })
        let deleteTreeUid = null
        let exist = false; //是否selection含有row的
        switch (this.pushObjType) {
          case 'appUser':
            selection.forEach(el => {
              if (el.roomId == row.roomId) {
                exist = true
              }
            })
            if (!exist) { //如果不存在，去掉这个tree
              this.$refs.tree.setChecked(row.roomId, false);
              deleteTreeUid = row.roomId
            }
            break
          case 'agency':
            if (this.clickTreeObj.type == 'agency') { //点击机关
              if (this.clickTreeObj.children) { //如果有chilren字段，就说明有部门
                selection.forEach(el => {
                  if (el.unitDeptId == row.unitDeptId) {
                    exist = true
                  }
                })
                if (!exist) { //如果不存在，去掉这个tree
                  this.$refs.tree.setChecked('department' + row.unitDeptId, false);
                  deleteTreeUid = 'department' + row.unitDeptId
                }
              } else { //如果没有部门，机关灭
                selection.forEach(el => {
                  if (el.unitId == row.unitId) {
                    exist = true
                  }
                })
                if (!exist) { //如果不存在，去掉这个tree
                  this.$refs.tree.setChecked('agency' + row.unitId, false);
                  deleteTreeUid = 'agency' + row.unitId
                }
              }
            } else { //点击部门，直接部门灭
              selection.forEach(el => {
                if (el.unitDeptId == row.unitDeptId) {
                  exist = true
                }
              })
              if (!exist) { //如果不存在，去掉这个tree
                this.$refs.tree.setChecked('department' + row.unitDeptId, false);
                deleteTreeUid = 'department' + row.unitDeptId

              }
            }
            break
          case 'company':
            if (this.clickTreeObj.type == 'company') { //点击机关
              if (this.clickTreeObj.children) { //如果有chilren字段，就说明有部门
                selection.forEach(el => {
                  if (el.unitDeptId == row.unitDeptId) {
                    exist = true
                  }
                })
                if (!exist) { //如果不存在，去掉这个tree
                  this.$refs.tree.setChecked('department' + row.unitDeptId, false);
                  deleteTreeUid = 'department' + row.unitDeptId
                }
              } else { //如果没有部门，机关灭
                selection.forEach(el => {
                  if (el.unitId == row.unitId) {
                    exist = true
                  }
                })
                if (!exist) { //如果不存在，去掉这个tree
                  this.$refs.tree.setChecked('company' + row.unitId, false);
                  deleteTreeUid = 'company' + row.unitId
                }
              }
            } else { //点击部门，直接部门灭
              selection.forEach(el => {
                if (el.unitDeptId == row.unitDeptId) {
                  exist = true
                }
              })
              if (!exist) { //如果不存在，去掉这个tree
                this.$refs.tree.setChecked('department' + row.unitDeptId, false);
                deleteTreeUid = 'department' + row.unitDeptId
              }
            }

            break
          case 'community':
            break
        }
        // 处理树结构
        this.activeTree.forEach(el => {
          if (el.type == this.pushObjType) {
            this.removeIfExistsInPlace(el.list, deleteTreeUid)
          }
        })
      }
      console.log(this.activeUser, '最终数据');

    },
    selectAll(selection) {//表格全选事件
      console.log(selection, '表格全选事件');
      let arr = [] //获取选中的人员id数组
      this.pushObjUserData.forEach((el, i) => {
        arr.push(el.id)
      })

      if (selection.length > 0) { //添加
        this.activeUser.forEach(activeEl => { //找到激活人员的list
          if (this.pushObjType == activeEl.type) {
            for (let element of arr) { // 验重添加

              if (!activeEl.list.includes(element)) {
                activeEl.list.push(element);
              }
            }
          }
        })
        let addTreeUid = null
        switch (this.pushObjType) {
          case 'appUser':
            this.pushObjUserData.forEach(el => {
              this.$refs.tree.setChecked(el.roomId, true)
              addTreeUid = el.roomId
            })
            break
          case 'agency':
            if (this.clickTreeObj.type == 'agency') { //点击机关
              if (this.clickTreeObj.children) { //如果有chilren字段，就说明有部门
                this.pushObjUserData.forEach(el => {
                  this.$refs.tree.setChecked('department' + el.unitDeptId, true)
                  addTreeUid = 'department' + el.unitDeptId
                })
              } else { //如果没有部门，机关亮
                this.pushObjUserData.forEach(el => {
                  this.$refs.tree.setChecked('agency' + el.unitId, true)
                  addTreeUid = 'agency' + el.unitId
                })
              }
            } else { //点击部门，直接部门亮
              this.pushObjUserData.forEach(el => {
                this.$refs.tree.setChecked('department' + el.unitDeptId, true)
                addTreeUid = 'department' + el.unitDeptId
              })
            }
            break
          case 'company':
            if (this.clickTreeObj.type == 'company') { //点击机构
              if (this.clickTreeObj.children) { //如果有chilren字段，就说明有部门
                this.pushObjUserData.forEach(el => {
                  this.$refs.tree.setChecked('department' + el.unitDeptId, true)
                  addTreeUid = 'department' + el.unitDeptId
                })
              } else { //如果没有部门，机构亮
                this.pushObjUserData.forEach(el => {
                  this.$refs.tree.setChecked('company' + el.unitId, true)
                  addTreeUid = 'company' + el.unitId
                })
              }
            } else { //点击部门，直接机构亮
              this.pushObjUserData.forEach(el => {
                this.$refs.tree.setChecked('department' + el.unitDeptId, true)
                addTreeUid = 'department' + el.unitDeptId
              })
            }
            break
        }
        // 处理树结构
        this.activeTree.forEach(el => {
          if (el.type == this.pushObjType) {
            this.addIfNotExists(el.list, addTreeUid)
          }
        })
      }
      if (selection.length == 0) { //去除
        this.activeUser.forEach(activeEl => { //找到激活人员的list
          if (this.pushObjType == activeEl.type) {
            activeEl.list = activeEl.list.filter(element => !arr.includes(element));
          }
        })
        let deleteTreeUid = null
        switch (this.pushObjType) {
          case 'appUser':
            this.pushObjUserData.forEach(el => {
              this.$refs.tree.setChecked(el.roomId, false)
              deleteTreeUid = el.roomId
            })
            break
          case 'agency':
            if (this.clickTreeObj.type == 'agency') { //点击机关
              if (this.clickTreeObj.children) { //如果有chilren字段，就说明有部门
                this.pushObjUserData.forEach(el => {
                  this.$refs.tree.setChecked('department' + el.unitDeptId, false)
                  deleteTreeUid = 'department' + el.unitDeptId
                })
              } else { //如果没有部门，机关亮
                this.pushObjUserData.forEach(el => {
                  this.$refs.tree.setChecked('agency' + el.unitId, false)
                  deleteTreeUid = 'agency' + el.unitId
                })
              }
            } else { //点击部门，直接部门亮
              this.pushObjUserData.forEach(el => {
                this.$refs.tree.setChecked('department' + el.unitDeptId, false)
                deleteTreeUid = 'department' + el.unitDeptId
              })
            }
            break
          case 'company':
            if (this.clickTreeObj.type == 'company') { //点击机构
              if (this.clickTreeObj.children) { //如果有chilren字段，就说明有部门
                this.pushObjUserData.forEach(el => {
                  this.$refs.tree.setChecked('department' + el.unitDeptId, false)
                  deleteTreeUid = 'department' + el.unitDeptId
                })
              } else { //如果没有部门，机构亮
                this.pushObjUserData.forEach(el => {
                  this.$refs.tree.setChecked('company' + el.unitId, false)
                  deleteTreeUid = 'company' + el.unitId
                })
              }
            } else { //点击部门，直接机构亮
              this.pushObjUserData.forEach(el => {
                this.$refs.tree.setChecked('department' + el.unitDeptId, false)
                deleteTreeUid = 'department' + el.unitDeptId
              })
            }
            break
        }
        // 处理树结构
        this.activeTree.forEach(el => {
          if (el.type == this.pushObjType) {
            this.removeIfExistsInPlace(el.list, deleteTreeUid)
          }
        })
      }
    },
    SSClick() { //搜索按钮
      console.log('搜索');
      this.getTableList()
    },



    getChinese(val) { //获取推送内容的文字
      function isJson(str) { //判断是否是json格式
        try {
          JSON.parse(str);
          return true;
        } catch (e) {
          return false;
        }
      }
      function extractChineseCharacters(str) { //去除html标签  获取文字
        // 去除HTML标签  
        const noHtml = str.replace(/<[^>]*>/g, '');
        // 匹配汉字的正则表达式（包括基本汉字和扩展汉字）  
        const chineseRegex = /[\u4e00-\u9fff\u3400-\u4dbf\u20000-\u2a6df\u2a700-\u2b73f\u2b740-\u2b81f\u2b820-\u2ceaf\uf900-\ufaff\u2f800-\u2fa1f]/g;
        // 提取所有匹配的汉字  
        const chineseCharacters = noHtml.match(chineseRegex) || [];
        // 将数组中的汉字连接成一个字符串  
        const chineseCharactersStr = chineseCharacters.join('');
        return chineseCharactersStr;
      }
      if (isJson(val)) {
        let htmlString = JSON.parse(val)
        let start = 'class="boxTop">'
        let index1 = htmlString.indexOf('class="boxTop">')
        let index2 = htmlString.indexOf('<div class="boxBottom"')
        if (index1 == -1 || index2 == -1) {
          return '-'
        }
        let data = htmlString.substring(index1 + start.length, index2)
        let chinese = extractChineseCharacters(data);
        return chinese.replace(/nbsp;/g, '');
      } else {
        return val
      }
    },
    DeleteFile(val) {
      console.log(val)
      this.DeleteFileData.push(val)
    },
    async getSeal() { //获取登录的印章
      let res = await this.$api.message.MygetSealDetail({
        "unitType": this.logOnUser.unitType, //机关agency  机构company
        "unitId": this.logOnUser.unitId
      })
      console.log(res, '登录机构印章');
      if (res.data) {
        console.log(666);
        this.Sealurl = res.data.image
        this.SealurlList = []
        this.SealId = res.data.id
        this.SealurlList.push(res.data.image)
      }

    },

    async getIsSuperAdmin() {//验证是否是超级管理员
      let res = await this.$api.message.MycheckUser({
        "unitType": this.logOnUser.unitType, //机关agency  机构company
        "unitId": this.logOnUser.unitId
      })
      this.IsSuperAdmin = res.data
    },
    async SealUpload(e) { //上传主体图之前需要先验证是否是管理员
      if (!this.IsSuperAdmin) {
        e.stopPropagation() // 阻止事件冒泡到父元素
        this.$message.error('请联系管理员上传印章');
      }
    },
    // 印章管理上传图片之前
    beforeUpload(file) {
      // 判断图片大小
      const isJPG = (file.type === 'image/jpeg') || (file.type === 'image/png') || (file.type === 'image/jpg');
      const isLt2M = file.size / 1024 / 1024 < 3;
      if (!isJPG) {
        this.$message.error('上传图片只能是 JPG/PNG 格式!');
      }
      if (!isLt2M) {
        this.$message.error('上传图片大小不能超过 3MB!');
      }
      return isJPG && isLt2M;
    },
    //印章管理上传文件
    async submitUpload(e) {
      console.log(e, '上传的值');
      let userData = JSON.parse(sessionStorage.getItem('logOnUser'))
      let formData = new FormData()
      formData.append('pics', e.file)
      formData.append('id', '')// 传文件
      axios({
        method: 'post',
        url: defaultUrl + '/business/seal/uploadImg', //此处为往后台发送请求的地址
        headers: {
          account: userData.account,
          token: userData.token,
        },
        data: formData,
        timeout: 20000,
      }).then(async res => {
        if (res.data.code == 200) {
          //上传图片之后走详情，如果有返回内容就走修改印章接口
          let SealDetail = await this.$api.message.MygetSealDetail({
            "unitType": this.logOnUser.unitType, //机关agency  机构company
            "unitId": this.logOnUser.unitId
          })
          let resdata
          if (SealDetail.data) { //如果有数据，走修改印章接口
            resdata = await this.$api.message.MyupdateSeal({
              "image": res.data.data[0],
              "unitType": this.logOnUser.unitType, //单位分类
              "unitId": this.logOnUser.unitId,
              "id": SealDetail.data.id
            })
          } else {//没数据走新增印章接口
            resdata = await this.$api.message.MyinsertSeal({
              "image": res.data.data[0],
              "unitType": this.logOnUser.unitType, //单位分类
              "unitId": this.logOnUser.unitId,
              "unitName": this.logOnUser.unitName,
            })
          }
          if (resdata.code == 200) {
            this.$message({
              message: '上传成功',
              type: 'success'
            });
            this.Sealurl = resdata.data.image
            this.SealurlList = [resdata.data.image]
          } else {
            this.$message.error(resdata.message);
          }
        }

      });
    },

    Preview(val) {
      if (!this.FaBuData.title) {
        this.$message.error('请填写标题')
        return
      }
      if (this.content == null) {
        this.content = ''
      }
      if (this.FaBuData.pushAnnex == '[]' || this.FaBuData.pushAnnex == undefined) {
        this.$set(this.FaBuData, 'pushAnnex', '')
      }

      // 推送内容最外层盒子
      let box = `<div style="transform-origin:0 0;width: 100%;background: white;margin: 0 auto;position: relative;min-height: 500px;">`

      // 处理推送内容的top盒子 标题  年 字 号 主题词
      let boxTop;
      if (this.FaBuData.characters && this.FaBuData.years && this.FaBuData.number && this.FaBuData.theme) { //全都有
        boxTop = `<div class="top" style="display: flex;flex-direction: column;align-items: center;"><div style="color: red;margin: 20px 0;font-size: 30px;font-family: cursive;">${this.FaBuData.title}</div><div>${this.FaBuData.characters}（${this.FaBuData.years}）${this.FaBuData.number}号</div><div style="width: 100%;height: 2px;background-color: red;"></div><div style="color: black;margin: 20px 0;font-size: 22px;font-weight: 600;">${this.FaBuData.theme}</div></div class="boxTop">`
      } else if (this.FaBuData.characters && this.FaBuData.years && this.FaBuData.number && !this.FaBuData.theme) { //有标题 年字号 没主题词
        boxTop = `<div class="top" style="display: flex;flex-direction: column;align-items: center;"><div style="color: red;margin: 20px 0;font-size: 30px;font-family: cursive;">${this.FaBuData.title}</div><div>${this.FaBuData.characters}（${this.FaBuData.years}）${this.FaBuData.number}号</div><div style="width: 100%;height: 2px;background-color: red;"></div></div class="boxTop">`
      } else if (!(this.FaBuData.characters && this.FaBuData.years && this.FaBuData.number) && this.FaBuData.theme) { //没年自号 有标题有主题词
        boxTop = `<div class="top" style="display: flex;flex-direction: column;align-items: center;"><div style="color: red;margin: 20px 0;font-size: 30px;font-family: cursive;">${this.FaBuData.title}</div><div style="width: 100%;height: 2px;background-color: red;"></div><div style="color: black;margin: 20px 0;font-size: 22px;font-weight: 600;">${this.FaBuData.theme}</div></div class="boxTop">`
      } else { //只有标题
        boxTop = `<div class="top" style="display: flex;flex-direction: column;align-items: center;"><div style="color: red;margin: 20px 0;font-size: 30px;font-family: cursive;">${this.FaBuData.title}</div><div style="width: 100%;height: 2px;background-color: red;"></div></div class="boxTop">`
      }


      // 处理推送内容的bottom盒子 附件 印章
      let boxBottom;
      if (!this.FaBuData.pushAnnex) { //没有附件的情况下
        if (this.isSeal == '盖章') { //没附件 有盖章
          this.$set(this.FaBuData, 'sealId', this.SealId) // 盖章 获取它的id
          boxBottom = `<div class="boxBottom"><img style=" position: absolute;bottom: 50px;right: 20px;width: 100px;height: 100px;" src="${this.Sealurl}"></div>`
        } else if (this.isSeal == '不盖章') { //既没附件  又没盖章
          this.$set(this.FaBuData, 'sealId', 0) //不盖章传0
          boxBottom = `<div class="boxBottom"></div>`
        }
      } else {//有附件的情况下
        let pushAnnexList = JSON.parse(this.FaBuData.pushAnnex)
        let annexData = ''
        pushAnnexList.forEach(el => {
          // annexData += `<span style="color:black" >${el.name}</span>`
          // annexData += `<a style="color:black" href="${defaultUrl}/business/notice/downloadAnnex?filename=${el.url}&account=${this.logOnUser.account}&token=${this.logOnUser.token}" target="_blank">${el.name}</a>`
          annexData += `<a style="color:black" href="${defaultUrl}/business/notice/downloadAnnex?filename=${el.url}&key=quich@123" target="_blank">${el.name}</a>`

        })
        let AnnexBox = `<div class="boxBottom"  style="margin-top:50px;display: flex;align-items: center;"><span>附件列表：</span><span style="display: flex;flex-direction: column;">${annexData}</span></div>`
        if (this.isSeal == '盖章') { //有附件 有盖章
          this.$set(this.FaBuData, 'sealId', this.SealId) // 盖章 获取它的id
          let SealImg = `<img style=" position: absolute;bottom: 50px;right: 20px;width: 100px;height: 100px;" src="${this.Sealurl}">`
          boxBottom = AnnexBox + SealImg
        } else if (this.isSeal == '不盖章') { //有附件  没盖章
          this.$set(this.FaBuData, 'sealId', 0) //不盖章传0
          boxBottom = AnnexBox
        }
      }
      let data = box + boxTop + this.content + boxBottom + `</div>`
      switch (val) {
        case 'PC':
        this.FaBuShow = false
          sessionStorage.setItem('PreviewData', JSON.stringify(data))
          this.$router.push('/Preview')
          
          return
        case 'APP':
          this.AppShow = true
          this.$nextTick(() => {
            console.log(data, 'data');
            let NB = document.querySelector('.App_main')
            NB.innerHTML = data

          })
          break
      }



    },
    radioChange(e) { //盖章/不盖章切换
      console.log(e);
      if (e == '盖章') {
        if (!this.Sealurl) {
          this.$confirm('系统检测当前未上传电子印章，请联系超级管理员上传或选择其他选项', '提示', {
            confirmButtonText: '上传',
            cancelButtonText: '取消',
            type: 'warning'
          }).then(() => {
            this.sealShow = true
          }).catch(() => {
            this.isSeal = '不盖章'
          });
        }

      }
    },
    getFile(arr) {  //富文本附件列表
      this.FaBuData.pushAnnex = JSON.stringify(arr)
      // arr.forEach((el) => {
      //   this.FaBuData.pushAnnex.push(el.url)
      // })
    },
    getImgList(arr) {//上传图片
      this.FaBuData.image = arr[0]
      this.TZGGShowList = arr
      console.log(this.FaBuData.image, '上传的图片的路径');
    },
    async deleteImg() { //删除发布对象的图片事件
      if (this.FaBuData.image == defaultUrl + '/image/default/notice/通知公告.png') {

      } else {
        this.oldImg = this.FaBuData.image
      }
      this.FaBuData.image = ''
      this.TZGGShowList = []

    },
    visibleChange(val) { //推送对象下拉框打开的时候，清空选项，这样就可以每次使用@change事件了
      if (val) {
        this.beforePushObjType = this.pushObjType
        this.pushObjType = ''
      } else if (!val && this.pushObjType == '') {//如果没选中任何类型，则换为原来的
        this.pushObjType = this.beforePushObjType
      }
    },
    sealClick() { //印章按钮
      this.sealShow = true
    },
    async getTableList() { // 获取表格列表
      if (this.typeTime == null) {
        this.typeTime = ['', '']
      }
      let res = await this.$api.message.MygetNoticeList({
        "unitType": this.logOnUser.unitType, //单位分类，机关:agency 机构:company
        "unitId": this.logOnUser.unitId, //单位id
        "departmentId": this.logOnUser.departmentId, //部门id
        "timeStart": this.typeTime[0], //起始时间
        "timeEnd": this.typeTime[1], //结束时间
        "keywords": this.keytitle, //关键字
        "pageSize": this.pageSize,
        "pageNum": this.pageNum
      })
      if (res.data.list.length == 0 && this.pageNum != 1) {
        this.pageNum = 1
        this.getTableList()
        return
      }
      this.tableData = res.data.list
      this.total = res.data.total
      console.log(res, '列表数据');
    },
    pageSizeChange(e) { //分页器——每页数量变化
      this.pageSize = e
      this.getTableList()
    },
    PageChange(e) {//分页器——页数变化
      this.pageNum = e
      this.getTableList()
    },
  },
}
</script>

<style lang="less" scoped>
.textBtn {
  position: relative;

  /deep/ .el-row {
    display: flex;
    justify-content: center;
  }

  .el {
    display: block;
    position: relative;

    &:nth-child(n+2) {
      &::after {
        position: absolute;
        left: -1px;
        top: 50%;
        content: '';
        width: 2px;
        transform: translateY(-50%) scale(0.5, 1);
        height: 10px;
        background-color: #aaa;
      }
    }
  }
}

.width1 {
  width: 200px;
}

.ZhuTiTuStyle {
  /deep/ .upload-demo {
    .el-upload-list__item {
      display: none;
    }
  }
}

.top {
  width: 100%;
  padding: 20px 30px;
  box-sizing: border-box;
  position: relative;

  .add {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
  }
}

.PushObjectStyle {
  display: flex;
  justify-content: space-between;

  .left {
    width: 250px;
    height: 450px;
    padding: 10px;
    border: 1px solid #eeeff2;
    box-sizing: border-box;

    /deep/.el-input {
      .el-input__inner {
        border-radius: 6px 0 0 6px;
      }
    }

    /deep/ .el-button {
      border-radius: 0 6px 6px 0;
    }

    .treeBox {
      width: 100%;
      height: 415px;
      overflow-y: scroll;

      &::-webkit-scrollbar {
        display: none;
      }

      /deep/ .el-tree-node__loading-icon {
        display: none;
      }
    }
  }

  .right {
    width: 720px;
    height: 450px;
    border: 1px solid #eeeff2;
    padding: 10px;
    box-sizing: border-box;

    .right_top {
      display: flex;
      justify-content: space-between;

      .key {
        /deep/.el-input {
          .el-input__inner {
            border-radius: 6px 0 0 6px;
          }
        }

        /deep/ .el-button {
          border-radius: 0 6px 6px 0;
        }
      }

    }

    .right_table {
      margin-top: 20px;
    }
  }
}

.pushObj_bottom {
  margin-top: 15px;
  width: 100%;
  display: flex;
  justify-content: flex-end;

  el-button {
    margin-right: 20px;
  }
}

.tableBox {
  margin-top: 50px;

  /deep/ .el-table {
    .has-gutter {
      .is-leaf {}
    }
  }

}

.FBGGStyle {
  /deep/ .el-dialog {
    .el-dialog__header {
      padding: 10px 20px;
    }

    .el-dialog__body {
      padding: 0 20px;

      .el-form {
        .el-form-item {
          margin-bottom: 0;

          .el-input {
            input {
              height: 30px;
              line-height: 30px;
            }

          }
        }
      }
    }

    .el-dialog__footer {
      padding: 10px 20px;
    }
  }

}

.AppStyle {
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 100000000;
  position: fixed;
  top: 0;
  left: 0;
  display: flex;
  justify-content: center;
  align-items: center;

  .box {
    width: 340px;
    height: 620px;
    background-color: white;
    border-radius: 50px;
    border: 10px solid black;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    overflow: hidden;

    .close {
      color: #23aaf2;
      font-weight: 600;
      position: absolute;
      top: 15px;
      right: 18px;
      cursor: pointer;
      z-index: 1;
    }



    .top {
      width: 100%;
      height: 50px;
      display: flex;
      align-content: center;
      position: relative;

      div {
        &:nth-child(1) {
          border-radius: 10000px;
          width: 15px;
          height: 15px;
          background-color: black;
        }

        &:nth-child(2) {
          position: absolute;
          right: 50%;
          transform: translateX(50%);
          border-radius: 10000px;
          width: 150px;
          height: 15px;
          background-color: black;
        }
      }
    }

    .mainTop {
      width: 100%;
      height: 40px;
      background-color: #de3425;
      display: flex;
      justify-content: center;
      align-items: center;
      font-weight: 600;
      color: white;
      font-size: 14px;
    }

    .App_main_box {
      &::-webkit-scrollbar {
        display: none;
      }

      .App_main {}
    }




    // .footer {
    //   width: 100%;
    //   height: 30px;

    //   position: relative;

    //   div {
    //     position: absolute;
    //     top: 50%;
    //     left: 50%;
    //     transform: translate(-50%, -50%);
    //     border-radius: 10000px;
    //     width: 180px;
    //     height: 10px;
    //     background-color: black;

    //   }
    // }
  }
}

.ZNHStyle {
  /deep/ .el-input {
    input {
      padding: 0 5px;
    }
  }
}
</style>